<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        let p={
            name:"小美",
            age:20
        };

        var mymap=new Map();
        mymap.set('id',21351);
        mymap.set('name',"这是名字");
        mymap.set('bir',new Date());
        mymap.set(p,"这是一个对象");
        var fn=function(){}
        mymap.set(fn,888);
        

        console.log(mymap);
        let bl=mymap.keys();
        console.log(bl);

        //遍历方法1
        // mymap.forEach(function(k,v){
        //     console.log(v,k);
        // })

        // //遍历方法2
        // for (let ooo of mymap) {
        //     console.log(ooo[0],ooo[1]);
        // }
        //遍历方法3
        for(let [key ,value] of mymap){
            console.log(key,value);
        }

        // 对象 转 数组
        var arr3=Object.entries(p)
        console.log(arr3);

        let [...arr4]=mymap
        console.log(arr4);

        var m=new Map(arr4)
        console.log(m);





        
        var hs=()=>{
            console.log("无参无返回值");
        }
        hs();

        hs=()=>{      
            return "无参有返回值";
        }
        console.log(hs());
        var hs=(a)=>{
            console.log("有参无返回值"+a);
        }
        hs("2.0");
        
        hs=(a,b)=>{
            return "有参有反回值"+(a+b);
        }
        console.log(hs(9,27));
        
        setTimeout(()=>{
            alert("hello");
        },1000)

      



    </script>



</body>
</html>